package com.tj.collection.task;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.fqgj.log.factory.LogFactory;
import com.fqgj.log.interfaces.Log;
import com.tj.collection.service.ClOutboundService;
import com.tj.collection.utils.ConfigUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: cashmama
 * @Date: 2020/9/25-14:30
 * @Description: TODO
 * @Slogan: To be or not to be
 **/
@Component
public class NoOverdueCallJob implements SimpleJob {
    private static final Log log = LogFactory.getLog(ClOutboundService.class);

    @Autowired
    private ClOutboundService clOutboundService;
    @Autowired
    private ConfigUtil configUtil;

    @Override
    public void execute(ShardingContext shardingContext) {
        log.info("------------无预期用户电话沟通定时任务执行开始---------start");
        if (!configUtil.getNoOverdueCallBack()) {
            log.info("------------无预期用户电话沟通定时任务 为关闭状态---------stop");
            return;
        }
        try {
            clOutboundService.noOverdueCall();
        } catch (Exception e) {
            e.printStackTrace();
            log.error("无预期用户电话沟通定时任务失败");
        }
        log.info("------------无预期用户电话沟通定时任务执行结束---------end");
    }
}
